var contador : int;
var passagem1 : GameObject;
var pulo : boolean;
function Start (){
alavanca = GameObject.FindGameObjectWithTag ("Alavanca");
}
function Update () {
if(Input.GetKey("d")||Input.GetKey("right"))
transform.Translate(-0.01,0,0);
if(Input.GetKey("a")||Input.GetKey("left"))
transform.Translate(0.01,0,0);
if((Input.GetKeyDown("w")||Input.GetKeyDown("up")) && pulo == true){
pulo = false;
Jump();
return;
}
}

function Jump (){
rigidbody.AddForce(Vector3.up * 360);
}
function OnCollisionEnter(piso : Collision){
if(piso.gameObject.name == "Chao")
{
pulo = true;
return;
}
}
function OnTriggerStay(next : Collider){
if(next.gameObject.name == "Fase1"){
Application.LoadLevel("Fase2");
}
if(next.gameObject.name == "Alavanca" && contador < 1){
next.gameObject.animation.Play();
passagem1.animation.Play();
print("Animation.Play();");
contador ++;
}
}
